package com.spring.nio.core.configuration;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: YSFY
 * @date: 2021-03-24 19:05
 * @pacage_name: com.spring.nio.core.configuration
 * @class_name: BootstrapConfig
 * @description: Bootstrap配置类
 */
public final class BootstrapConfig {
    /**
     * 监听地址
     * */
    private InetSocketAddress inetSocketAddress;

    /**
     * Selector线程
     * */
    private Map<String, SelectorEntity> selectors = new HashMap<>();

    /**
     * Acceptor线程
     * */
    private Map<String, AcceptorEntity> acceptors = new HashMap<>();

    /**
     * spring高级容器
     * */
    private ClassPathXmlApplicationContext classPathXmlApplicationContext = null;

    /**
     * 心跳检测线程
     * */
    private Thread heartBeanThread;

    /**
     * 心跳线程结束标志
     * */
    private static Boolean heartBeatStop;

    public BootstrapConfig() {}

    public InetSocketAddress getInetSocketAddress() {
        return inetSocketAddress;
    }

    public void setInetSocketAddress(InetSocketAddress inetSocketAddress) {
        this.inetSocketAddress = inetSocketAddress;
    }

    public Map<String, SelectorEntity> getSelectors() {
        return selectors;
    }

    public void setSelectors(Map<String, SelectorEntity> selectors) {
        this.selectors = selectors;
    }

    public Map<String, AcceptorEntity> getAcceptors() {
        return acceptors;
    }

    public void setAcceptors(Map<String, AcceptorEntity> acceptors) {
        this.acceptors = acceptors;
    }

    public ClassPathXmlApplicationContext getClassPathXmlApplicationContext() {
        return this.classPathXmlApplicationContext;
    }

    public void setClassPathXmlApplicationContext(ClassPathXmlApplicationContext classPathXmlApplicationContext) {
        this.classPathXmlApplicationContext = classPathXmlApplicationContext;
    }

    public Thread getHeartBeanThread() {
        return heartBeanThread;
    }

    public void setHeartBeanThread(Thread heartBeanThread) {
        this.heartBeanThread = heartBeanThread;
    }

    public static Boolean getHeartBeatStop() {
        return heartBeatStop;
    }

    public static void setHeartBeatStop(Boolean heartBeatStop) {
        BootstrapConfig.heartBeatStop = heartBeatStop;
    }
}
